# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=hexorbase
pkgver=6
pkgrel=5
epoch=2
groups=('blackarch' 'blackarch-fuzzer' 'blackarch-scanner')
pkgdesc='A database application designed for administering and auditing multiple database servers simultaneously from a centralized location. It is capable of performing SQL queries and bruteforce attacks against common database servers (MySQL, SQLite, Microsoft SQL Server, Oracle, PostgreSQL).'
url='https://code.google.com/p/hexorbase/'
arch=('any')
license=('GPL3')
depends=('python2' 'python2-pyqt4' 'mysql-python' 'python2-psycopg2' 'pymssql'
         'python2-qscintilla')
optdepends=('python2-cx_oracle: Oracle database')
source=("$pkgname::svn+http://hexorbase.googlecode.com/svn/HexorBase/")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  _ver=$(svnversion)

  printf "%s" "${_ver//[[:alpha:]]}"
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin/"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  cp -a --no-preserve=ownership * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python2 /usr/share/$pkgname/execute.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

